package cn.sjx.graduate.web.controller;

import cn.sjx.graduate.domain.Employee;
import cn.sjx.graduate.service.IEmployeeService;
import cn.sjx.graduate.util.JsonResult;
import cn.sjx.graduate.web.anno.Log;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * @Author: bo-feifei
 * @Date 2021/11/10 19:25
 * @Version 1.0
 */
@Controller
@RequestMapping
@Api(tags = "登录相关信息接口")
public class LoginController {
    @Autowired
    private IEmployeeService employeeService;

    /**
     * 登录后期等 小石头 把前端写好了在进行修改
     * 首先要通过尝试获取网页Session 看是否登录过
     * 再进行登录的逻辑业务。
     *
     * @param user
     * @return
     */
    @ResponseBody
    @Log(title = "用户登录")
    @PostMapping("/login")
    public JsonResult<?> login(@RequestBody Employee user) {
        Map<String, Object> emp = employeeService.login(user);
        return JsonResult.success(emp);

    }
}
